@using Microsoft.AspNetCore.Identity
@using OrchardCore.Entities
@using OrchardCore.Settings
@using OrchardCore.Users
@using OrchardCore.Users.Models
@model OrchardCore.Users.ViewModels.RegisterViewModel

@inject ISiteService SiteService
@{ 
    ViewLayout = "Layout__Login";
     var disableLocalLogin = (await SiteService.GetSiteSettingsAsync()).As<LoginSettings>().DisableLocalLogin;
}

<h1>@T["Create a new account"]</h1>
<form asp-controller="Registration" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
    <hr />
    <div asp-validation-summary="All" class="text-danger"></div>
    <div class="form-group">
        <label asp-for="UserName" class="control-label asterix">@T["Username"]</label>
        <input asp-for="UserName" class="form-control" aria-describedby="UserName-described-by" />
        <span id="UserName-described-by" asp-validation-for="UserName" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="Email" class="control-label asterix">@T["Email"]</label>
        <input asp-for="Email" class="form-control" aria-describedby="Email-described-by" />
        <span id="Email-described-by" asp-validation-for="Email" class="text-danger"></span>
    </div>
    <div class="form-group">
        <label asp-for="Password" class="control-label asterix">@T["Password"]</label>
        <input asp-for="Password" class="form-control" aria-describedby="Password-described-by" />
        <div id="Password-described-by">
          <span  asp-validation-for="Password" class="text-danger"></span>
          <small class="form-text text-muted">@T["Your password must be at least 8 characters long and contain at least one uppercase letter, one lowercase letter, a number and a special character"]</small>
        </div>
    </div>
    <div class="form-group">
        <label asp-for="ConfirmPassword" class="control-label asterix">@T["Confirm password"]</label>
        <input asp-for="ConfirmPassword" class="form-control" aria-describedby="ConfirmPassword-described-by" />
        <span id="ConfirmPassword-described-by" asp-validation-for="ConfirmPassword" class="text-danger"></span>
    </div>
    @await RenderSectionAsync("AfterRegister", required: false)
    <div class="form-group mt-4">
        <button type="submit" class="btn btn-primary"><span>@T["Create a new account"]</span></button>
    </div>
</form>
 @if (!disableLocalLogin)
  {
    <div class="mt-4">
      <a asp-route-area="OrchardCore.Users" asp-controller="Account" asp-action="Login">@T["Already have an account? Login"]</a>
    </div>
  }